<template>
  <li 
    :class="[
      'bx-list-item',
      'bx-glass',
      {
        'bx-list-item--action': $slots.action
      }
    ]"
  >
    <div class="bx-list-item__main">
      <div v-if="$slots.prefix" class="bx-list-item__prefix">
        <slot name="prefix"></slot>
      </div>
      <div class="bx-list-item__content">
        <slot></slot>
      </div>
      <div v-if="$slots.suffix" class="bx-list-item__suffix">
        <slot name="suffix"></slot>
      </div>
    </div>
    <div v-if="$slots.action" class="bx-list-item__action">
      <slot name="action"></slot>
    </div>
  </li>
</template>

<script>
export default {
  name: 'BxListItem'
}
</script>

<style scoped>
.bx-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--bx-glass-border);
  transition: background-color var(--bx-transition-fast);
}

.bx-list-item:last-child {
  border-bottom: none;
}

.bx-list-item:hover {
  background: var(--bx-glass-bg-hover);
}

.bx-list-item__main {
  flex: 1;
  display: flex;
  align-items: center;
}

.bx-list-item__prefix {
  margin-right: 12px;
}

.bx-list-item__content {
  flex: 1;
  color: var(--bx-text-primary);
  font-size: 14px;
}

.bx-list-item__suffix {
  margin-left: 12px;
}

.bx-list-item__action {
  margin-left: 24px;
}

/* Responsive */
@media (max-width: 768px) {
  .bx-list-item {
    flex-direction: column;
    align-items: flex-start;
    padding: 10px 14px;
  }
  .bx-list-item__main {
    width: 100%;
    margin-bottom: 8px;
  }
  .bx-list-item__action {
    margin-left: 0;
    width: 100%;
    text-align: right;
  }
}
</style>

